package com.hlxt.nj.common;

import com.alibaba.fastjson.JSON;

import java.util.HashMap;
import java.util.Map;

public class RespMessageUtil {

    public static String getJSONStr(String retCode,Object result){
        Map<String,Object> map = new HashMap<String, Object>();
        map.put("retCode", retCode);
        map.put("result", result);
        map.put("retMessage", RetCodeDef.retCodeMap.get(retCode));
        return JSON.toJSONString(map);
    }

    public static RespMessage getResp(String retCode,Object result){
        RespMessage respMessage = new RespMessage();
        respMessage.setResult(result);
        respMessage.setRetCode(retCode);
        respMessage.setRetMessage(RetCodeDef.retCodeMap.get(retCode));
        return respMessage;
    }

}
